﻿@model KL.Store.Web.Models.WishListsModel
@using KL.Store.Core
@{
    ViewBag.Title = "Lists";
    Layout = "~/Views/Shared/" + Parameters.Layout + ".cshtml";
}
@section menu {
    @{ Html.RenderAction("Categories", "Partials"); }}
<div class="breadcrumb">
    <a href="/">Ana Sayfa</a> &raquo; <a href="/Friend/Lists">Arkadaşımın Listeleri</a>
</div>
<h1>
    Arkadaşımın Listeleri</h1>
<div class="cart-info">
    <div class="shop-cart">
        <table>
            <thead>
                <tr>
                    <td class="name">
                        Ad Soyad
                    </td>
                    <td class="name">
                        Liste Adı
                    </td>
                    <td class="name">
                        Yapıldığı Tarih
                    </td>
                    <td class="quantity" style="border-right: none;">
                        Ürün
                    </td>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.WishLists)
                {
                    <tr>
                        <td class="name">
                            <a id="pl_@item.ListId" class="lstLink" href="/Friend/ListDetail/?UserId=@(item.UserId.ToString())&ListId=@(item.ListId.ToString())">@(item.FirstName)
                                @(item.LastName)</a>
                        </td>
                        <td class="name">
                            @item.ListName
                        </td>
                        <td class="name">
                            @item.CreateDate
                        </td>
                        <td style="border-right: 0;">
                                <div class="left">
                                    <a class="button-cont-right" href="/Friend/ListDetail/?UserId=@(item.UserId.ToString())&ListId=@(item.ListId.ToString())"><span>@item.ItemCount</span></a>
                                </div>
                        </td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
</div>
<script type="text/javascript">
    $('a.cgLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Categories/Get', { id: qsId });
        return false;
    });
    $('a.prLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Products/Get', { id: qsId });
        return false;
    });

    $('a.prdLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Product/Get', { id: qsId });
        return false;
    });

    $('a.rmLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        $('#content').load('/Cart/Remove', { id: qsId }, function () { RefreshCartSummary(); });
        return false;
    });

    $('a.upLink').click(function () {
        var qsId = $(this).attr('id').split("_")[1];
        var qty = $('#qty_' + qsId.toString()).val();
        $('#content').load('/Cart/Update', { 'id': qsId, 'qty': qty }, function () { RefreshCartSummary(); });
        return false;
    });

    function RefreshCartSummary() {
        $('#cart').load('/Cart/GetSummary', {});
    }
</script>